package com.xhh.adjust.controller.v1;

import com.xhh.adjust.service.AdjustService;
import com.xhh.model.adjust.dtos.AddAdjustDto;
import com.xhh.model.adjust.dtos.AdjustPageDto;
import com.xhh.model.adjust.dtos.AdjustUpdateDto;
import com.xhh.model.common.dtos.ResponseResult;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;

@Api(tags = "缺额管理接口")
@RestController
@RequestMapping("/adjust")
@RequiredArgsConstructor
public class AdjustController {

    private final AdjustService adjustService;

    @ApiOperation("新增缺额信息")
    @PostMapping("/add")
    public ResponseResult addAdjustment(@RequestBody AddAdjustDto addAdjustDto){
        return adjustService.addAdjustment(addAdjustDto);
    }

    @ApiOperation("分页查询缺额信息")
    @GetMapping("/page")
    public ResponseResult getAdjustmentByPage(AdjustPageDto dto){
        return adjustService.getAdjustmentByPage(dto);
    }

    @ApiOperation("更新缺额信息")
    @PutMapping("/update")
    public ResponseResult updateAdjustment(@RequestBody AdjustUpdateDto dto){
        return adjustService.updateAdjustment(dto);
    }


}
